﻿using System;
using System.Runtime.Serialization;
using MultiViewer.Network;
using System.Windows.Input;
using System.Windows;

namespace MultiViewer.Display
{
    public enum MouseButton
    {
        LeftDown,
        LeftUp,
        RightDown,
        RightUp
    }
    [DataContract]
    public class InitDisplayRequest : Message
    {
        private int width, height,cursorwidth,cursorheight;
        private bool fullscreen,cursor;

        public InitDisplayRequest(DisplayConfigurationElement config)
        {
            this.width = config.Width;
            this.height = config.Height;
            this.fullscreen = config.Fullscreen;
            this.cursor = config.MousePress;
            this.cursorwidth = config.CursorWidth;
            this.cursorheight = config.CursorHeight;
        }

        [DataMember]
        public int Width
        {
            get { return width; }
            set { width = value; }
        }

        [DataMember]
        public int Height
        {
            get { return height; }
            set { height = value; }
        }

        [DataMember]
        public bool Fullscreen
        {
            get { return fullscreen; }
            set { fullscreen = value; }
        }
        [DataMember]
        public bool Cursor
        {
            get { return cursor; }
            set { cursor = value; }
        }
        [DataMember]
        public int CursorWidth
        {
            get { return cursorwidth; }
            set { cursorwidth = value; }
        }
        [DataMember]
        public int CursorHeight
        {
            get { return cursorheight; }
            set { cursorheight = value; }
        }
    }

    [DataContract]
    public class ShutdownRequest
    {
        // No members here
    }

    [DataContract]
    public class MouseNotification : Message
    {
        private double x,y;

        [DataMember]
        public double X
        {
            get { return x; }
            set { x = value; }
        }

        [DataMember]
        public double Y
        {
            get { return y; }
            set { y = value; }
        }

        public Point Position
        {
            get { return new Point(x, y); }
            set
            {
                x = value.X;
                y = value.Y;
            }
        }
    }


    [DataContract]
    public class MouseClickNotification : Message
    {
        private double x, y;
        private MouseButton button;

        [DataMember]
        public MouseButton buttonProp
        {
            get { return button; }
            set { button = value; }
        }

        [DataMember]
        public double X
        {
            get { return x; }
            set { x = value; }
        }

        [DataMember]
        public double Y
        {
            get { return y; }
            set { y = value; }
        }

        public Point Position
        {
            get { return new Point(x, y); }
            set
            {
                x = value.X;
                y = value.Y;
            }
        }
        public MouseButton Button
        {
            get { return button; }
            set { button = value; }
        }
    }
}